# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.AdSense.V14.Api.Accounts do
  @moduledoc """
  API calls for all endpoints tagged `Accounts`.
  """

  alias GoogleApi.AdSense.V14.Connection
  alias GoogleApi.Gax.{Request, Response}

  @library_version Mix.Project.config() |> Keyword.get(:version, "")

  @doc """
  Get information about the selected AdSense account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to get information about.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:tree` (*type:* `boolean()`) - Whether the tree of sub accounts should be returned.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.Account{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_get(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.AdSense.V14.Model.Account.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_get(connection, account_id, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :tree => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}", %{
        "accountId" => URI.encode(account_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.Account{}])
  end

  @doc """
  List all accounts available to this AdSense account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of accounts to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through accounts. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.Accounts{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_list(Tesla.Env.client(), keyword(), keyword()) ::
          {:ok, GoogleApi.AdSense.V14.Model.Accounts.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_list(connection, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts", %{})
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.Accounts{}])
  end

  @doc """
  Get Auto ad code for a given ad client.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account which contains the ad client.
  *   `ad_client_id` (*type:* `String.t`) - Ad client to get the code for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:tagPartner` (*type:* `String.t`) - Tag partner to include in the ad code snippet.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.AdCode{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_adclients_get_ad_code(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.AdCode.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_adclients_get_ad_code(
        connection,
        account_id,
        ad_client_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :tagPartner => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients/{adClientId}/adcode", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.AdCode{}])
  end

  @doc """
  List all ad clients in the specified account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account for which to list ad clients.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of ad clients to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through ad clients. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.AdClients{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_adclients_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.AdSense.V14.Model.AdClients.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_adclients_list(connection, account_id, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.AdClients{}])
  end

  @doc """
  Gets the specified ad unit in the specified ad client for the specified account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the ad client belongs.
  *   `ad_client_id` (*type:* `String.t`) - Ad client for which to get the ad unit.
  *   `ad_unit_id` (*type:* `String.t`) - Ad unit to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.AdUnit{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_adunits_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.AdUnit.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_adunits_get(
        connection,
        account_id,
        ad_client_id,
        ad_unit_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1),
        "adUnitId" => URI.encode(ad_unit_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.AdUnit{}])
  end

  @doc """
  Get ad code for the specified ad unit.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account which contains the ad client.
  *   `ad_client_id` (*type:* `String.t`) - Ad client with contains the ad unit.
  *   `ad_unit_id` (*type:* `String.t`) - Ad unit to get the code for.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.AdCode{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_adunits_get_ad_code(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.AdCode.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_adunits_get_ad_code(
        connection,
        account_id,
        ad_client_id,
        ad_unit_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/adcode", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1),
        "adUnitId" => URI.encode(ad_unit_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.AdCode{}])
  end

  @doc """
  List all ad units in the specified ad client for the specified account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the ad client belongs.
  *   `ad_client_id` (*type:* `String.t`) - Ad client for which to list ad units.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:includeInactive` (*type:* `boolean()`) - Whether to include inactive ad units. Default: true.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of ad units to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.AdUnits{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_adunits_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.AdUnits.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_adunits_list(
        connection,
        account_id,
        ad_client_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :includeInactive => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients/{adClientId}/adunits", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.AdUnits{}])
  end

  @doc """
  List all custom channels which the specified ad unit belongs to.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the ad client belongs.
  *   `ad_client_id` (*type:* `String.t`) - Ad client which contains the ad unit.
  *   `ad_unit_id` (*type:* `String.t`) - Ad unit for which to list custom channels.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of custom channels to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.CustomChannels{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_adunits_customchannels_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.CustomChannels.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_adunits_customchannels_list(
        connection,
        account_id,
        ad_client_id,
        ad_unit_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/accounts/{accountId}/adclients/{adClientId}/adunits/{adUnitId}/customchannels",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1),
          "adUnitId" => URI.encode(ad_unit_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.CustomChannels{}])
  end

  @doc """
  Dismiss (delete) the specified alert from the specified publisher AdSense account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account which contains the ad unit.
  *   `alert_id` (*type:* `String.t`) - Alert to delete.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_alerts_delete(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) :: {:ok, nil} | {:ok, Tesla.Env.t()} | {:ok, list()} | {:error, any()}
  def adsense_accounts_alerts_delete(
        connection,
        account_id,
        alert_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:delete)
      |> Request.url("/accounts/{accountId}/alerts/{alertId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "alertId" => URI.encode(alert_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [decode: false])
  end

  @doc """
  List the alerts for the specified AdSense account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account for which to retrieve the alerts.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:locale` (*type:* `String.t`) - The locale to use for translating alert messages. The account locale will be used if this is not supplied. The AdSense default (English) will be used if the supplied locale is invalid or unsupported.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.Alerts{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_alerts_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.AdSense.V14.Model.Alerts.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_alerts_list(connection, account_id, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :locale => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/alerts", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.Alerts{}])
  end

  @doc """
  Get the specified custom channel from the specified ad client for the specified account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the ad client belongs.
  *   `ad_client_id` (*type:* `String.t`) - Ad client which contains the custom channel.
  *   `custom_channel_id` (*type:* `String.t`) - Custom channel to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.CustomChannel{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_customchannels_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.CustomChannel.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_customchannels_get(
        connection,
        account_id,
        ad_client_id,
        custom_channel_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1),
          "customChannelId" =>
            URI.encode(custom_channel_id, &(URI.char_unreserved?(&1) || &1 == ?/))
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.CustomChannel{}])
  end

  @doc """
  List all custom channels in the specified ad client for the specified account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the ad client belongs.
  *   `ad_client_id` (*type:* `String.t`) - Ad client for which to list custom channels.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of custom channels to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through custom channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.CustomChannels{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_customchannels_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.CustomChannels.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_customchannels_list(
        connection,
        account_id,
        ad_client_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients/{adClientId}/customchannels", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.CustomChannels{}])
  end

  @doc """
  List all ad units in the specified custom channel.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the ad client belongs.
  *   `ad_client_id` (*type:* `String.t`) - Ad client which contains the custom channel.
  *   `custom_channel_id` (*type:* `String.t`) - Custom channel for which to list ad units.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:includeInactive` (*type:* `boolean()`) - Whether to include inactive ad units. Default: true.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of ad units to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through ad units. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.AdUnits{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_customchannels_adunits_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.AdUnits.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_customchannels_adunits_list(
        connection,
        account_id,
        ad_client_id,
        custom_channel_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :includeInactive => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url(
        "/accounts/{accountId}/adclients/{adClientId}/customchannels/{customChannelId}/adunits",
        %{
          "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
          "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1),
          "customChannelId" => URI.encode(custom_channel_id, &URI.char_unreserved?/1)
        }
      )
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.AdUnits{}])
  end

  @doc """
  List the payments for the specified AdSense account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account for which to retrieve the payments.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.Payments{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_payments_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.AdSense.V14.Model.Payments.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_payments_list(connection, account_id, optional_params \\ [], opts \\ []) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/payments", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.Payments{}])
  end

  @doc """
  Generate an AdSense report based on the report request sent in the query parameters. Returns the result as JSON; to retrieve output in CSV format specify "alt=csv" as a query parameter.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account upon which to report.
  *   `start_date` (*type:* `String.t`) - Start of the date range to report on in "YYYY-MM-DD" format, inclusive.
  *   `end_date` (*type:* `String.t`) - End of the date range to report on in "YYYY-MM-DD" format, inclusive.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:currency` (*type:* `String.t`) - Optional currency to use when reporting on monetary metrics. Defaults to the account's currency if not set.
      *   `:dimension` (*type:* `list(String.t)`) - Dimensions to base the report on.
      *   `:filter` (*type:* `list(String.t)`) - Filters to be run on the report.
      *   `:locale` (*type:* `String.t`) - Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of rows of report data to return.
      *   `:metric` (*type:* `list(String.t)`) - Numeric columns to include in the report.
      *   `:sort` (*type:* `list(String.t)`) - The name of a dimension or metric to sort the resulting report on, optionally prefixed with "+" to sort ascending or "-" to sort descending. If no prefix is specified, the column is sorted ascending.
      *   `:startIndex` (*type:* `integer()`) - Index of the first row of report data to return.
      *   `:useTimezoneReporting` (*type:* `boolean()`) - Whether the report should be generated in the AdSense account's local timezone. If false default PST/PDT timezone will be used.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.AdsenseReportsGenerateResponse{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_reports_generate(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.AdsenseReportsGenerateResponse.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_reports_generate(
        connection,
        account_id,
        start_date,
        end_date,
        optional_params \\ [],
        opts \\ []
      ) do
    opts =
      if Keyword.get(optional_params, :alt) == "media",
        do: Keyword.put_new(opts, :decode, false),
        else: opts

    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :currency => :query,
      :dimension => :query,
      :filter => :query,
      :locale => :query,
      :maxResults => :query,
      :metric => :query,
      :sort => :query,
      :startIndex => :query,
      :useTimezoneReporting => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/reports", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_param(:query, :startDate, start_date)
      |> Request.add_param(:query, :endDate, end_date)
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(
      opts ++ [struct: %GoogleApi.AdSense.V14.Model.AdsenseReportsGenerateResponse{}]
    )
  end

  @doc """
  Generate an AdSense report based on the saved report ID sent in the query parameters.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the saved reports belong.
  *   `saved_report_id` (*type:* `String.t`) - The saved report to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:locale` (*type:* `String.t`) - Optional locale to use for translating report output to a local language. Defaults to "en_US" if not specified.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of rows of report data to return.
      *   `:startIndex` (*type:* `integer()`) - Index of the first row of report data to return.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.AdsenseReportsGenerateResponse{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_reports_saved_generate(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.AdsenseReportsGenerateResponse.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_reports_saved_generate(
        connection,
        account_id,
        saved_report_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :locale => :query,
      :maxResults => :query,
      :startIndex => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/reports/{savedReportId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "savedReportId" => URI.encode(saved_report_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(
      opts ++ [struct: %GoogleApi.AdSense.V14.Model.AdsenseReportsGenerateResponse{}]
    )
  end

  @doc """
  List all saved reports in the specified AdSense account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the saved reports belong.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of saved reports to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through saved reports. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.SavedReports{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_reports_saved_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.AdSense.V14.Model.SavedReports.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_reports_saved_list(
        connection,
        account_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/reports/saved", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.SavedReports{}])
  end

  @doc """
  List a specific saved ad style for the specified account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account for which to get the saved ad style.
  *   `saved_ad_style_id` (*type:* `String.t`) - Saved ad style to retrieve.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.SavedAdStyle{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_savedadstyles_get(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.SavedAdStyle.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_savedadstyles_get(
        connection,
        account_id,
        saved_ad_style_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/savedadstyles/{savedAdStyleId}", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "savedAdStyleId" => URI.encode(saved_ad_style_id, &(URI.char_unreserved?(&1) || &1 == ?/))
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.SavedAdStyle{}])
  end

  @doc """
  List all saved ad styles in the specified account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account for which to list saved ad styles.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of saved ad styles to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through saved ad styles. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.SavedAdStyles{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_savedadstyles_list(Tesla.Env.client(), String.t(), keyword(), keyword()) ::
          {:ok, GoogleApi.AdSense.V14.Model.SavedAdStyles.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_savedadstyles_list(
        connection,
        account_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/savedadstyles", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.SavedAdStyles{}])
  end

  @doc """
  List all URL channels in the specified ad client for the specified account.

  ## Parameters

  *   `connection` (*type:* `GoogleApi.AdSense.V14.Connection.t`) - Connection to server
  *   `account_id` (*type:* `String.t`) - Account to which the ad client belongs.
  *   `ad_client_id` (*type:* `String.t`) - Ad client for which to list URL channels.
  *   `optional_params` (*type:* `keyword()`) - Optional parameters
      *   `:alt` (*type:* `String.t`) - Data format for the response.
      *   `:fields` (*type:* `String.t`) - Selector specifying which fields to include in a partial response.
      *   `:key` (*type:* `String.t`) - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.
      *   `:oauth_token` (*type:* `String.t`) - OAuth 2.0 token for the current user.
      *   `:prettyPrint` (*type:* `boolean()`) - Returns response with indentations and line breaks.
      *   `:quotaUser` (*type:* `String.t`) - An opaque string that represents a user for quota purposes. Must not exceed 40 characters.
      *   `:userIp` (*type:* `String.t`) - Deprecated. Please use quotaUser instead.
      *   `:maxResults` (*type:* `integer()`) - The maximum number of URL channels to include in the response, used for paging.
      *   `:pageToken` (*type:* `String.t`) - A continuation token, used to page through URL channels. To retrieve the next page, set this parameter to the value of "nextPageToken" from the previous response.
  *   `opts` (*type:* `keyword()`) - Call options

  ## Returns

  *   `{:ok, %GoogleApi.AdSense.V14.Model.UrlChannels{}}` on success
  *   `{:error, info}` on failure
  """
  @spec adsense_accounts_urlchannels_list(
          Tesla.Env.client(),
          String.t(),
          String.t(),
          keyword(),
          keyword()
        ) ::
          {:ok, GoogleApi.AdSense.V14.Model.UrlChannels.t()}
          | {:ok, Tesla.Env.t()}
          | {:ok, list()}
          | {:error, any()}
  def adsense_accounts_urlchannels_list(
        connection,
        account_id,
        ad_client_id,
        optional_params \\ [],
        opts \\ []
      ) do
    optional_params_config = %{
      :alt => :query,
      :fields => :query,
      :key => :query,
      :oauth_token => :query,
      :prettyPrint => :query,
      :quotaUser => :query,
      :userIp => :query,
      :maxResults => :query,
      :pageToken => :query
    }

    request =
      Request.new()
      |> Request.method(:get)
      |> Request.url("/accounts/{accountId}/adclients/{adClientId}/urlchannels", %{
        "accountId" => URI.encode(account_id, &URI.char_unreserved?/1),
        "adClientId" => URI.encode(ad_client_id, &URI.char_unreserved?/1)
      })
      |> Request.add_optional_params(optional_params_config, optional_params)
      |> Request.library_version(@library_version)

    connection
    |> Connection.execute(request)
    |> Response.decode(opts ++ [struct: %GoogleApi.AdSense.V14.Model.UrlChannels{}])
  end
end
